package com.ravi.controller;

import com.github.pagehelper.PageInfo;
import com.ravi.model.entity.ItemType;
import com.ravi.model.query.CommonPageReq;
import com.ravi.model.resp.R;
import com.ravi.service.intf.ItemTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ItemTypeController {

	@Autowired
	private ItemTypeService itemTypeService;

	@PostMapping("/itemtype/all")
	public R getAllItemsPage(@RequestBody CommonPageReq commonPageReq) {
		PageInfo<ItemType> pageInfo = itemTypeService.listItemTypePage(commonPageReq.getPageNum(), commonPageReq.getPageSize());
		return R.ok().put("pageInfo", pageInfo);
	}
}
